﻿using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.ComponentModel;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Media;

namespace 软件发布平台.ViewModel
{
    public class AppRecordViewModel : Notify
    {
        ObservableCollection<string> _Customers = new ObservableCollection<string>();
        public ObservableCollection<string> Customers 
        {
            get => _Customers;
            set { _Customers = value; RaisePropertyChanged("Customers"); }
        }
        private string _Customer;

        public string Customer
        {
            get { return _Customer; }
            set { _Customer = value; RaisePropertyChanged("Customer"); }
        }
        private ObservableCollection<string> _Products = new ObservableCollection<string>();

        public ObservableCollection<string> Products
        {
            get { return _Products; }
            set { _Products = value; RaisePropertyChanged("Products"); }
        }

        private string _Product;

        public string Product
        {
            get { return _Product; }
            set { _Product = value; RaisePropertyChanged("Product"); }
        }
        private ObservableCollection<string> _AppNames = new ObservableCollection<string>();

        public ObservableCollection<string> AppNames
        {
            get { return _AppNames ; }
            set { _AppNames = value; RaisePropertyChanged("AppNames"); }
        }
        private string _AppName;

        public string AppName
        {
            get { return _AppName; }
            set { _AppName = value; RaisePropertyChanged("AppName"); }
        }


        private List<AppItem> _AppItems = new List<AppItem>() { };
        public List<AppItem> AppItems 
        {
            get => _AppItems;
            set { _AppItems = value; RaisePropertyChanged("AppItems"); }
        }

        public class AppItem : Notify
        {
            string _AppId;

            public string AppId
            {
                get { return _AppId; }
                set { _AppId = value; RaisePropertyChanged("AppId"); }
            }
            int _ID;

            public int ID
            {
                get { return _ID; }
                set { _ID = value; }
            }
            string _Cus;

            public string Cus
            {
                get { return _Cus; }
                set { _Cus = value; RaisePropertyChanged("Cus"); }
            }

            string _Pro;

            public string Pro
            {
                get { return _Pro; }
                set { _Pro = value; RaisePropertyChanged("Pro"); }
            }

            string _AppName;

            public string AppName
            {
                get { return _AppName; }
                set { _AppName = value; RaisePropertyChanged("AppName"); }
            }

            string _Ver;

            public string Ver
            {
                get { return _Ver; }
                set { _Ver = value; RaisePropertyChanged("Ver"); }
            }

            bool _Enable = true;

            public bool Enable
            {
                get { return _Enable; }
                set { _Enable = value; RaisePropertyChanged("Enable"); }
            }

            bool _IsAdmin = false;
            public bool IsAdmin
            {
                get { return _IsAdmin; }
                set { _IsAdmin = value; RaisePropertyChanged("IsAdmin"); }
            }
            string _ReleaseUser;

            public string ReleaseUser
            {
                get { return _ReleaseUser; }
                set { _ReleaseUser = value; }
            }

            string _ReleaseTime;

            public string ReleaseTime
            {
                get { return _ReleaseTime; }
                set { _ReleaseTime = value; }
            }
            string _CheckUser1;
            public string CheckUser1
            {
                get { return _CheckUser1; }
                set { _CheckUser1 = value; }
            }

            string _CheckUser2;

            public string CheckUser2
            {
                get { return _CheckUser2; }
                set { _CheckUser2 = value; }
            }
            string _CheckTime;

            public string CheckTime
            {
                get { return _CheckTime; }
                set { _CheckTime = value; }
            }

            string _PushUser;

            public string PushUser
            {
                get { return _PushUser; }
                set { _PushUser = value; }
            }
            string _ReleaseLog;

            public string ReleaseLog
            {
                get { return _ReleaseLog; }
                set { _ReleaseLog = value; }
            }
            SolidColorBrush _BackColor = new SolidColorBrush(Color.FromRgb(238, 238, 133));
            public SolidColorBrush BackColor
            {
                get { return _BackColor; }
                set { _BackColor = value; }
            }
        }
        public class Notify : INotifyPropertyChanged
        {
            public event PropertyChangedEventHandler PropertyChanged;
            protected virtual void RaisePropertyChanged(string propertyname)
            {
                this.PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyname));
            }
        }
    }
}
